home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Dev / Obrn-A_1.6_src.lha / oberon-a / texts2.lha / texts / InternalData.txt next >
Text File  |  1995-07-02  |  6KB  |  153 lines

  1.      $RCSfile: InternalData.txt $
  2.   Description: Description of internal data structures used by the compiler
  3.  
  4.    Created by: fjc (Frank Copeland)
  5.     $Revision: 1.4 $
  6.       $Author: fjc $
  7.         $Date: 1995/01/26 00:06:47 $
  8.  
  9.   Copyright © 1994, Frank Copeland.
  10.   This file is part of Oberon-A.
  11.   See Oberon-A.doc for conditions of use and distribution.
  12.   ________________________________________________________________________
  13.  
  14.   [WARNING: this document has not been kept properly up to date]
  15.  
  16.   INTRODUCTION
  17.  
  18.   This document describes the internal data structures used by the
  19.   Oberon-A compiler.  It should be read with reference to section 12.3 of
  20.   Project Oberon (1).  This document presents the modifications made in
  21.   porting the compiler from the NS32x32 processors to the MC68000.
  22.  
  23.   OBJECT AND ITEM MODES
  24.  
  25.   Object modes - basic modes of declared identifiers.
  26.  
  27.   Var         Variable (global and local variable, value parameters)
  28.   Ind         Indirect (variable parameters)
  29.   Con         Constant
  30.   Fld         Record field
  31.   Typ         User defined and basic types
  32.   LProc       Local procedure
  33.   XProc       Exportable procedure
  34.   SProc       Standard procedure
  35.   LibCall     Amiga library function definition
  36.   IProc       Interrupt handler procedure
  37.   Mod         Module
  38.   Head        Head of list of objects
  39.  
  40.   Item modes - non-basic modes generated in expressions.
  41.  
  42.   Reg         direct register mode (intermediate result in expression)
  43.   RegI        indirect register mode (dereferencing pointers, variable
  44.               parameters)
  45.   RegX        indirect, indexed register mode (access to array element in
  46.               expression)
  47.   Stk         stack mode (procedure parameters, saved registers)
  48.   Coc         condition code mode (evaluation of boolean expressions (?))
  49.   Abs         absolute mode (?)
  50.  
  51.   DATA STRUCTURE ALIASES
  52.  
  53.   The Object, Item and Struct types used in the symbol table are actually
  54.   variant records.  For the sake of simplicity and portability (and
  55.   because the Oberon language does not have variant record types) these
  56.   types have a number of anonymous fields that are interpreted according
  57.   to  the mode or form field of the record.
  58.  
  59.   Table 12.2 (modified)
  60.   --------+------------------+-----------------------------
  61.           | Objects          | Items
  62.   mode    | a0    a1    a2   | lev   a0    a1    a2    obj
  63.   --------+------------------+-----------------------------
  64.   Var     | adr   rcvr       | lev   adr
  65.   VarX    |                  | lev   adr         RX
  66.   VarR    | R                | lev   R
  67.   Ind     | adr   rcvr       | lev   adr   off
  68.   IndX    |                  | lev   adr   off   RX
  69.   IndR    | R                | lev   R
  70.   Con     | val   val        |       val   val
  71.           | sadr  leng  mno  | mno   sadr  leng  char       (strings)
  72.   RegI    |                  |       R     off
  73.   RegX    |                  |       R     off   RX
  74.   Lab     |                  |       off   size
  75.   LabI    |                  |       off   size
  76.   Push    |                  |       R
  77.   Pop     |                  |       R
  78.   Coc     |                  |       CC    Tjmp  Fjmp
  79.   Brnch   |                  |
  80.   Reg     |                  |       R
  81.   Fld     | off              |       off               obj
  82.   Typ     |                  | mno   tadr              obj
  83.   LProc   | pno              | lev   pno               obj
  84.   XProc   |                  | mno                     obj
  85.   TProc   | pno   tlev  lnk  | mno   pno   tlev  super obj
  86.   SProc   | fno              |       fno
  87.   Mod     | mno   key        |       mno               obj
  88.   Head    | lev   psize      |
  89.   LibCall | foff             | mno   foff              obj
  90.   LibCall2| adr   foff       | mno   adr   foff
  91.  
  92.   --------+----------------------
  93.           | Objects
  94.   mode    | left  right  link
  95.   --------+----------------------
  96.   Var     |              next
  97.   VarX    |              next
  98.   VarR    |              next
  99.   Ind     |              next
  100.   IndX    |              next
  101.   IndR    |              next
  102.   LProc   |              pars
  103.   XProc   |              pars
  104.   TProc   | next         pars
  105.   Head    | next  vars   objects
  106.   LibCall | next         pars
  107.   LibCall2| next         pars
  108.   Fld     | next
  109.  
  110.   -------------------------------------------------
  111.   Structures
  112.   form      BaseTyp   link    mno   n       adr
  113.   -------------------------------------------------
  114.   Pointer   PBaseTyp                        descno
  115.   ProcTyp   ResTyp    param
  116.   Array     ElemTyp           mno   nofel
  117.   DynArr    ElemTyp
  118.   Record    BaseTyp   fields  mno   tlev    descno
  119.  
  120.   Explanation of field names
  121.  
  122.   adr      - base address of object
  123.   lev      - lexical level of declaration
  124.   obj      - back pointer to object structure for item
  125.   off      - offset from base address or register
  126.   RX       - register number of index register
  127.   R        - register number
  128.   val      - value of constant (longreals use both a0 and a1, others only a0)
  129.   sadr     - base address of string constant
  130.   leng     - length of string constant
  131.   CC       - condition code number
  132.   Tjmp     - address of code executed if expression result is TRUE
  133.   Fjmp     - address of code executed if expression result is FALSE
  134.   mno      - module number
  135.   tadr     - address of record type descriptor (?)
  136.   pars     - list of procedure parameters
  137.   pno      - procedure number
  138.   Ladr     - address of procedure code
  139.   fno      - standard procedure number
  140.   psize    - no idea :-)
  141.   PBaseTyp - pointer base type
  142.   ResTyp   - procedure result type
  143.   param    - list of procedure parameters
  144.   ElemTyp  - array element type
  145.   nofel    - number of elements in array
  146.   bounds   - address of array bounds constant
  147.   BaseTyp  - record base type
  148.   fields   - list of record fields
  149.   descno   - record type descripter number
  150.   foff     - library vector offset of function
  151.   size     - size of reference: 1 - byte, 2 = word, 4 = long
  152.   tlev     - inheritance level of record type
  153.